import requests
from bs4 import BeautifulSoup
req=requests.get('http://www.baidu.com')
req.encoding='utf-8'
soup=BeautifulSoup(req.text,'lxml')
print(soup.title.string)
print(soup.select('head>title')[0].text)
